# -*- coding: cp932 -*-
'''
Created on 2012/05/01

@author: rusyou
'''
from builder.Builder import Builder

class HTMLBuilder(Builder):
    '''
    classdocs
    '''
    filename = ""
    writer = None

    def makeTitle(self, title):
        '''
        Constructor
        '''
        self.filename = title + ".html"
        self.writer = open(self.filename, "w")
        self.writer.write("<html><head><title>" + title + "</title></head><body>\n")
        self.writer.write("<h1>" + title + "</h1>\n")

    def makeString(self, msg):
        self.writer.write("<p>" + msg + "</p>\n")

    def makeItems(self, items):
        self.writer.write("<ul>\n")
        for item in items:
            self.writer.write("<li>" + item + "</li>\n")
        self.writer.write("</ul>\n")

    def close(self):
        self.writer.write("</body></html>")
        self.writer.close()

    def getResult(self):
        return self.filename